package com.jianyi.model;

import com.jfinal.plugin.activerecord.Model;
import com.jianyi.util.StringUtils;

public class User extends Model<User>{

	private static final long serialVersionUID = -2929579257546666751L;
	public static final User dao = new User();

	public User getUserByUsernameAndPassword(String username,String password){
		if(StringUtils.isEmpty(username)){
			return null;
		}
		if(StringUtils.isEmpty(password)){
			return null;
		}
		
		return this.findFirst("select * from t_user t where t.removed='0' and t.username=? and password=?",username,password);
	}
	
	public User getUserByUsername(String username){
		return this.findFirst("select * from t_user t where t.username=?",username);
	}
	
	public boolean hasRole(String role){
		return false;
	}
	
	public boolean checkResource(String resource){
		return true;
	}
}
